package com.example.mapper;

import com.example.pojo.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {

    @Select("select * from category where create_user = #{id}")
    List<Category> list(Integer id);

    @Insert("insert into category (category_name, category_price, create_user, create_time, update_time) " +
            "values (#{categoryName},#{categoryPrice},#{createUser},#{createTime},#{updateTime});")
    void AddCategory(Category category);

    @Update("update category set category_name = #{categoryName},category_price = #{categoryPrice},update_time = #{updateTime} where id = #{id}")
    void updateCategory(Category category);

    @Select("select * from category where id = #{id}")
    Category GetCategoryById(Integer id);

    @Delete("delete from category where id = #{id}")
    void deleteCategoryById(Integer id);

    @Select("select * from category where create_user = #{id}")
    List<Category> selectAll(Integer id);

    void batchInsert(List cachedDataList);

    @Select("select * from category")
    List<Category> findAll();

    @Select("select category.category_name from category where id = #{id}")
    String findCategoryName(Integer id);

    @Select("select * from category")
    List<Category> selectExportData();


}
